clear all, close all, clc;



init_name;

load(data_base_save_name)

full_data_base = data_base;

edge_set = data_base{1}.edge_set;



clear data_base


for i = 9:length( full_data_base )
    data_base{i-7} = full_data_base{i};
end
    
for append_id = 1:8

    
    %sel_classifier_id = [sel_classifier_id belong_id{append_id} ];
    if(isempty(data_base{1}))           
        data_base{1} = full_data_base{ append_id };
    else

        data_base{1}.name = [   data_base{1}.name ' + ' ...
                                full_data_base{ append_id }.name];
        data_base{1}.start = [data_base{1}.start ...
                                full_data_base{ append_id }.start];
        data_base{1}.end = [data_base{1}.end ...
                                full_data_base{ append_id }.end];
        data_base{1}.rate = [data_base{1}.rate ...
                                full_data_base{ append_id }.rate];
        data_base{1}.frame_n = [data_base{1}.frame_n ...
                               + full_data_base{ append_id }.frame_n];

        data_base{1}.score_matrix = [data_base{1}.score_matrix;
                                 full_data_base{ append_id }.score_matrix];

        data_base{1}.Fmatrix = [data_base{1}.Fmatrix;
                                 full_data_base{ append_id }.Fmatrix];
        data_base{1}.ZeroOne = [data_base{1}.ZeroOne;
                                 full_data_base{ append_id }.ZeroOne];

        for k = 1:length( data_base{1}.global_feat)
            data_base{1}.global_feat{k} = [data_base{1}.global_feat{k};
                                        full_data_base{ append_id }.global_feat{k}];
        end

        data_base{1}.corr_pos =     data_base{1}.corr_pos ...
                                + full_data_base{ append_id }.corr_pos;
        data_base{1}.corr_neg =     data_base{1}.corr_neg ...
                                + full_data_base{ append_id }.corr_neg;

        try                
            data_base{1}.recommend_matrix = [data_base{1}.recommend_matrix;...
                                 full_data_base{ append_id }.recommend_matrix];
        catch
            disp('warning no recommen_matrix!')
            if_recommen_matrix = 0;
        end


    end        
end

save( [data_base_save_name '_merge'],'data_base')